import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const querySysDict = (params) => {
  params.head.transCode = 'querySysDict';
  return request({
    url: '/platform/sysDict/querySysDict',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const querySysDictListPage = (params) => {
  params.head.transCode = 'querySysDictListPage';
  return request({
    url: '/platform/sysDict/querySysDictListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysDict = (params) => {
  params.head.transCode = 'saveSysDict';
  return request({
    url: '/platform/sysDict/saveSysDict',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveSysDictList = (params) => {
  params.head.transCode = 'saveSysDictList';
  return request({
    url: '/platform/sysDict/saveSysDictList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysDict = (params) => {
  params.head.transCode = 'saveOrUpdateSysDict';
  return request({
    url: '/platform/sysDict/saveOrUpdateSysDict',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysDictList = (params) => {
  params.head.transCode = 'saveOrUpdateSysDictList';
  return request({
    url: '/platform/sysDict/saveOrUpdateSysDictList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysDict = (params) => {
  params.head.transCode = 'updateSysDict';
  return request({
    url: '/platform/sysDict/updateSysDict',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteSysDict = (params) => {
  params.head.transCode = 'deleteSysDict';
  return request({
    url: '/platform/sysDict/deleteSysDict',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysDictList = (params) => {
  params.head.transCode = 'deleteSysDictList';
  return request({
    url: '/platform/sysDict/deleteSysDictList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportSysDictExcel = (params) => {
  downloadExcel({
    url: '/platform/sysDict/exportSysDictExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
